<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>新增用户</title>
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/reset.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/common.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome.min.css">
<!--公共样式结束-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/module_form.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/page_memberAdd.css">
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.min.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.timer.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/common.js"></script>
</head>

<body>
	<div class="page_header">
		<div class="tabbar">
			<ul class="tab clearfix" tabname="tab1">
				<li class="tabhover" show="tab1_0">新增用户</li>
			</ul>
		</div>
	</div>
	<div class="page_wraper">
		<div id="tab1_0" fortab="tab1">
			<form action="" method="post" id="memberAdd_form">
			<input type="hidden" name="solevar"  id="solevar"  value="{:create_id()}"/>
			<input type="hidden" name="company"  id="company"  value="{$company.id}"/>
            <!-- <input type="hidden" name="name"     id="name"     value="{$company.title}"/>
            <input type="hidden" name="username" id="username" value="{$company.username}"/> -->
            <input type="hidden" name="outlet"   id="outlet"   value=""/>
            
			<table cellpadding="0" cellspacing="0" class="module_form" width="600">
			<fieldset>
				<tr>
					<td style="width: 100px;"><label for="title">所属角色：<em>*</em></label></td>
					<td class="ele_content">
						<select name="role" id="role" class="form_ele_text width_200">
                           <option value="">请选择</option>
                           <volist name="role" id="v">
                           		<option value="{$v.id}">{$v.title}</option>
                           </volist>
                         </select>
					</td>
					<td style="width: 100px;"><label for="outletid">所属城市：<em>*</em></label></td>
					<td class="ele_content">
						<select name="cityid" id="cityid" class="form_ele_text width_200">
								<option value="">请选择</option>
                            <volist name="address" id="v">
                            	<eq name="v[2]" value="2"> 
                            		<option value="{$key}">{$v[0]}</option>
                            	</eq>
                            </volist>
                          </select>
					</td>
				</tr>
				<tr>
					<td style="width: 100px;"><label for="jobno">用户名：<em>*</em></label></td>
					<td class="ele_content">
						<input value="{$detail.username}" name="username" type="text" id="username" class="form_ele_text width_200">
					</td>
					<td style="width: 100px;"><label for="password">密码：<em>*</em></label></td>
					<td class="ele_content">
						<input value="{$detail.password}" type="password" name="password" id="password" class="form_ele_text width_200">
					</td>
				</tr>
				<tr>
					<td style="width: 100px;"><label for="realname">姓名：<em>*</em></label></td>
					<td class="ele_content">
						<input value="{$detail.realname}" type="text" name="realname" id="realname" class="form_ele_text width_200">
					</td>
					<td style="width: 100px;"><label for="sex">性别：<em>*</em></label></td>
					<td class="ele_content">
						<input type="radio" value="1" name="sex" checked="checked" />男&nbsp;&nbsp;&nbsp;
						<input type="radio" value="2" name="sex" />女
					</td>
				</tr>
				<tr>
					<td style="width: 100px;"><label for="mobile">手机号码：<em>*</em></label></td>
					<td class="ele_content">
						<input value="{$detail.mobile}" type="text" name="mobile" id="mobile" class="form_ele_text width_200">
					</td>
					<td style="width: 100px;"><label for="email">邮箱：<em>*</em></label></td>
					<td class="ele_content">
						<input value="{$detail.email}" type="text" name="email" id="email" class="form_ele_text width_200">
					</td>
				</tr>
				<tr>
					<td style="width: 100px;"><label for="sort">描述：</label></td>
					<td class="ele_content" colspan="3">
						<textarea rows="3" name="remark" id="remark" class="large m-wrap"></textarea>
					</td>
				</tr>
				</fieldset>
			</table>
			</form>
		</div>
	</div>
	<div class="page_footer pdtd10">
		<input type="button" name="submit" value="确  认"  class="form_ele_submit"/>
		<input type="reset" name="reset"   value="取  消"  class="form_ele_reset"/>
	</div>
</body>
<script type="text/javascript">
	//弹出窗口全局变量
	var api = frameElement.api, W = api.opener;
	
	function getOutlet(){
		var outlet = $("select[name=outletid]").find("option:selected").attr("outlet");
		if(outlet){
			$("input[name=outlet]").val(outlet);
		}
	}
	
	$(function(){
		
		getOutlet();
		$('select[name=outletid]').bind('change',function(){
			getOutlet();
	   });
		
		//滑动门
		$('.tabbar li').click(function(){
			var tabname = $('.tabbar>ul').attr('tabname');
			$('.tabbar li').removeClass('tabhover');
			$(this).addClass('tabhover');
			
			$('div[fortab="'+tabname+'"]').hide();
			$('#'+$(this).attr('show')).show();
		});
		
		//表格隔行换色
		$('.module_form tr:odd').addClass('odd');
		$('.module_form tr:even').addClass('even');
		
		//表单操作
		//重置
		$('.form_ele_reset').on('click',function(){
			$('#memberAdd_form').get(0).reset();
		});
		
		//提交
		$('.form_ele_submit').on('click',function(){
			
			var tipsObj = windowApi.lhgdialog.tips('正在提交数据...',10,etIcon.loading);
			
			//通过Ajax提交表单
			/* var postData = {};
			postData.company   = $('#title').val(); */
			var postData = $('#memberAdd_form').serialize();
			
			$.post("{:U('Company/adminAdd')}", postData ,
				function(data){tipsObj.close();
					windowApi.lhgdialog.tips('新增用户成功！',1,etIcon.success,function(){
						
						var obj = windowApi.lhgdialog.list['Company_admin'];
						if(obj){
							obj.reload(obj);
						}
						frameApi.close();
					});
				}, "json"
			);
		});
	});
</script>
</html>
